var connection = require("../mysqldb");

/* 
var updateSql = {
  init: function (res, data) {
    console.log("执行了更新数据库的操作");
    var sql = "UPDATE hhpwuser SET user='" + data.user + "',password='" + data.password + "";
    connection.query(sql, function (err, result) {
      if (err) {
        console.log('[SELECT ERROR] - ', err.message);
        return;
      } else {
        console.log("更新成功");
        res.write("更新成功");
        res.end();
      }
    })
  }
} */


class updateSql {
  constructor() { }
  init(res, data) {
    console.log("执行了更新数据库的操作");
    var sql = "UPDATE hhpwuser SET user='" + data.user + "',password='" + data.password + "";
    connection.query(sql, (err, result) => {
      if (err) {
        console.log('[SELECT ERROR] - ', err.message);
        return;
      } else {
        console.log("更新成功");
        res.write("更新成功");
        res.end();
      }
    })
  }
}


module.exports = new updateSql;